package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "9021000129618468";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCCCjrEpMeB1OuoNgrKYmqTMnxkVpiVTZeEILCFLil04qTfkn5ipvTO/2venfml1J4yEoXb9iZAeKh1wUkuqK45O8emw0jmVNutjF10JX513Jl5dBcYPt1JrNvk1w/9dPWQAgFGo150q2foNewf+Ec8ABW5Gw3ht5+axgMPlEcSEjg9ep1BRFZs5dwHepQw+nkAZpWezK0N2Jh96HIClSaYHQ38uIT1AYjuhztviGgdaBebPz98w+U1zYNlLQjsoiZwbdU/fAhrzWbZKVGuU+zxZYhiQBkXthtafJKz3Efn2ru6C3QCoscCcdFQXtpILaXUfoVX6k1RJ6Ega0OZs/+pAgMBAAECggEAbTasLrT5fdfV51sj6t+HBIL1J8v2sAYPh39w4Rlo5ernb4F4NeBkYGjyLnBc1+JezkzyMU9kxubPDL69eLtgP18uiacfVZrVOMdXQZGvyMrx9qgCMXGypgrQTzw0CLku97hHXA0e6jt+s+59lkgNg53KoMDRAs4V9IXy0iXFHq4NJJY14iHB9g9+vsE9Yxn2p7+Us9TNIrRpaJav/EsId423SS1+AzeGdaIg96oJnnGnl3Z5M2UAo9WEE34uBHqPuSkSi+pk10Lo7JY/85tZfaWr6GWL1JDE1KHuGNBg3ahKbwdBMeMJcS/BHZlYnwgiN8DqhdNWOyz8ADMAH05BgQKBgQDF2sRj+bueEc9Bn5UgcT3gti+qECfIhL7Pt28hO9FvqR8GnpcnWVLRZ1DAntUZEUrtQS9awqdLWqRT2zC+56yKVEi939evyy4Q7zyNvp0/ovw9Yl8d+JgBuITbjwXVuVOua7Pz6oqYUmqqCjuwiia3BGv5JOvzIAXMmrSUUoQcEQKBgQCoQY15NPf4BngXNQJIlKqEa/1UEdWxJejGfKksJja/BOEh433iTzT7KKT0OlqzJBRkscM0EgLyC8OQkKr8ZPueOQsBOHdaUT+OGeQAD8DiuVRcS+v+X0RhnZUxYBvbBYN78vRHIug6bQc7J9tP6qVhRr58yDXJyssg64onXOMiGQKBgBUSi8AqJPVc6DoRCQz/gpugS8tNFS+iE8CDxO5BNLkzxf4qfebO+Kcc3djmEcQtt1E1lBmSicbYzI+x1KtAeXvyJh0y7gHnHeznzgc6ufzBGyReicrjYy0rvdq0jOaKaoM1LWFZJZG7lWiu1lSjIiRz8BwE9qxaSMPV5k21zCRBAoGAGVzgTZANfQbEnYLxGC3I0nNQ2ZZipvR29UyfV7de80ZyBWC8fhvAecezrdkKCQz8Qf2F1liMtx3M2gLks20pfL1Oil2PqD6tHOeMNfIp+kNDkzIindKQhUJy1eGN8WMQYePKrNp3NS9wMpucdJyDV3mJh1fKu+Nk4U6AIdTfrCkCgYBwOFIh0S9SOfngrFpofJMpoYhaIZ8cthYfb1GF7wvFgIaYa8ffkloXrUXYihEjP6d2+I6K1UfVl7h/kduVcBe9DJ1NUO9GlGUuW8vhKKfrsac7d70NJwByPY1j8TV5im+vgkuoJ/+TqwOPZ83MqaIqyynxvc/WcL/GqUtwce2f4g==";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmvHVEVrZJQPEiVLoMjKOj05V5FtXSOUVjLh3YZFVupP/BVIhu9tTamv+DMKVJDi3Mk5nsF1YrSsL9DlpyA2p0O5xDqfuzdo994934oGB7sqHQ9KZmkhigUGL9720Z7P4SfnT7a5mUzAueC9N9E8okykDK3dlUj1k3bLRc7R36jG5TF/XGfFwT5m8lWuErwqh7Qv7uxWo1ZqmAvnDMu6hvHNoUpPAO9OpXuhO/uibPs3mk0chGgEqi5RAZvZpEp9KbJR6aOK+vzaiAMxDUwdQ0Ky1PHlhU0/+QWUa64m+FGQKfDObTLlD8VDqsd17m1ocqnObUzW2j57oVBjjRGWTBQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

